package com.example.autocode.enums;

import lombok.Getter;

/**
 * @author zhangxin
 */
@Getter
public enum CycleMethodEnum {
    CYCLE_METHOD_YEAR("1", "流水号循环方式-按年"),
    CYCLE_METHOD_MONTH("2", "流水号循环方式-按月"),
    CYCLE_METHOD_DAY("3", "流水号循环方式-按日"),
    CYCLE_METHOD_HOUR("4", "流水号循环方式-按时"),
    CYCLE_METHOD_MINUTE("5", "流水号循环方式-按分"),
    CYCLE_METHOD_INPUT("6", "流水号循环方式-按传入参数"),
    CYCLE_METHOD_OTHER("other", "其他");

    private final String code;

    private final String name;

    CycleMethodEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public static CycleMethodEnum getByCode(String code) {
        for (CycleMethodEnum value : CycleMethodEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return CYCLE_METHOD_OTHER;
    }
}
